# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.

# CMake lowest version requirement
cmake_minimum_required(VERSION 3.5.1)
# project information
project(resource_optical_clip_detector)

# Compile options
add_compile_options(-std=c++11)

# Specify target generation path
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY  ".")
set(CMAKE_CXX_FLAGS_DEBUG "-fPIC -O0 -g -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -O2 -Wall")

set(INC_PATH "/home/HwHiAiUser/Ascend/nnrt/latest")
set(LIB_PATH "/home/HwHiAiUser/Ascend/nnrt/latest/runtime/lib64/stub/")

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
message(STATUS "opencv path:"${OpenCV_INCLUDE_DIRS})

# Header path
include_directories(
    ${INC_PATH}/runtime/include/
    ${PROJECT_SOURCE_DIR}/include/yolov3_clip_detector
)

# add host lib path
link_directories(
    ${LIB_PATH}
)

add_library(${PROJECT_NAME} SHARED
        src/yolov3_clip_detector/yolov3_clip_detector.cpp
)

#SET(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath-link,$ENV{INSTALL_DIR}/runtime/lib64/stub")

add_executable(main main.cpp)

target_link_libraries(main ${PROJECT_NAME} ascendcl stdc++ opencv_highgui opencv_core opencv_imgproc opencv_imgcodecs opencv_calib3d opencv_features2d)

install(TARGETS main DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
